package test4;

import java.util.*;

public class test {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        HashMap<String,Integer> hm=new HashMap<>();
        while(sc.hasNext()){
            String str=sc.next();
            if(str.equals("!!!!!")){
                break;}
            else{
                if(hm.get(str)==null){
                    hm.put(str,1);

            }else
                hm.put(str,hm.get(str)+1);
            }

        }
        List<HashMap.Entry<String,Integer>> ls=new ArrayList<HashMap.Entry<String, Integer>>(hm.entrySet());
        Collections.sort(ls, new Comparator<HashMap.Entry<String,Integer>>() {
            public int compare(HashMap.Entry<String,Integer> o1, HashMap.Entry<String,Integer> o2){
                if(o1.getValue()==o2.getValue()){
                    return o1.getKey().compareTo(o2.getKey());
                }
                return o2.getValue();
            }
        });
        System.out.println(hm.size());
        int num=0;
        for(HashMap.Entry<String,Integer> m:ls){
            if(num==10)
                break;
            System.out.println(m.getKey()+"="+m.getValue());
            num++;
        }
        sc.close();
    }
}
